widget: Remove app-paintable
authorTimm Bäder <mail@baedert.org>
Sun, 30 Oct 2016 16:01:19 +0000 (17:01 +0100)
committerTimm Bäder <mail@baedert.org>
Mon, 31 Oct 2016 18:28:28 +0000 (19:28 +0100)
18 files changed:
demos/gtk-demo/foreigndrawing.c
demos/gtk-demo/toolpalette.c
docs/reference/gtk/gtk4-sections.txt
docs/tools/widgets.c
gtk/gtkdnd.c
gtk/gtkeventbox.c
gtk/gtkglarea.c
gtk/gtkwidget.c
gtk/gtkwidget.h
gtk/gtkwidgetprivate.h
gtk/gtkwindow.c
tests/animated-resizing.c
tests/motion-compression.c
tests/testellipsise.c
tests/testgtk.c
tests/testpopup.c
tests/testtooltips.c
tests/video-timer.c

index d0248472d4226dab025ccd4ad4aec1a4cf2b6651..11b8b44068b2c8880dd13e875d76e8933de5c360 100644 (file)
@@ -971,7 +971,6 @@ do_foreigndrawing (GtkWidget *do_widget)
       gtk_widget_set_size_request (da, 400, 400);
       gtk_widget_set_hexpand (da, TRUE);
       gtk_widget_set_vexpand (da, TRUE);
-      gtk_widget_set_app_paintable (da, TRUE);
       gtk_container_add (GTK_CONTAINER (box), da);
 
       g_signal_connect (da, "draw", G_CALLBACK (draw_cb), NULL);
index 7ebaf25244ec46abd76a426ad09750ca23b447d1..da6dfa25718ce77651007f0c464c4d8ff94ab030 100644 (file)
@@ -567,7 +567,6 @@ do_toolpalette (GtkWidget *do_widget)
       /* ===== passive DnD dest ===== */
 
       contents = gtk_drawing_area_new ();
-      gtk_widget_set_app_paintable (contents, TRUE);
 
       g_object_connect (contents,
                         "signal::draw", canvas_draw, NULL,
@@ -594,7 +593,6 @@ do_toolpalette (GtkWidget *do_widget)
       /* ===== interactive DnD dest ===== */
 
       contents = gtk_drawing_area_new ();
-      gtk_widget_set_app_paintable (contents, TRUE);
 
       g_object_connect (contents,
                         "signal::draw", canvas_draw, NULL,
index f76eb567ab18a9e2bf73759ef07b7a845de7b0f8..eb7bebc2dd68025211260725d9819ef213f9bcfe 100644 (file)
@@ -4705,7 +4705,6 @@ gtk_widget_render_icon
 gtk_widget_render_icon_pixbuf
 gtk_widget_queue_draw_area
 gtk_widget_queue_draw_region
-gtk_widget_set_app_paintable
 gtk_widget_set_redraw_on_allocate
 gtk_widget_mnemonic_activate
 gtk_widget_class_install_style_property
@@ -4763,7 +4762,6 @@ gtk_widget_get_allocated_baseline
 gtk_widget_get_allocated_size
 gtk_widget_get_clip
 gtk_widget_set_clip
-gtk_widget_get_app_paintable
 gtk_widget_get_can_default
 gtk_widget_set_can_default
 gtk_widget_get_can_focus
index 5c2a7a21d01ad02eaed5f32528890b97abae037b..412fa9bfebec06a3d96185ab868d8aa437fa2152 100644 (file)
@@ -798,7 +798,6 @@ create_page_setup_dialog (void)
                                                 settings);
 
   info = new_widget_info ("pagesetupdialog", widget, ASIS);
-  gtk_widget_set_app_paintable (info->window, FALSE);
   info->include_decorations = TRUE;
 
   return info;
index 56ea797f46fa98f622e75ddda303291d4cb62806..608dfaa30db991cb07d025fc80bca46a0b1ee343 100644 (file)
@@ -1579,20 +1579,16 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
 
   if (!info->icon_window)
     {
-      GdkDisplay *display;
       GdkScreen *screen;
 
       screen = gdk_window_get_screen (gdk_drag_context_get_source_window (context));
-      display = gdk_window_get_display (gdk_drag_context_get_source_window (context));
 
       info->icon_window = gtk_window_new (GTK_WINDOW_POPUP);
       gtk_window_set_type_hint (GTK_WINDOW (info->icon_window), GDK_WINDOW_TYPE_HINT_DND);
       gtk_window_set_screen (GTK_WINDOW (info->icon_window), screen);
       gtk_widget_set_size_request (info->icon_window, 24, 24);
       gtk_widget_set_events (info->icon_window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
-
-      if (gdk_display_is_composited (display))
-        gtk_widget_set_app_paintable (info->icon_window, TRUE);
+      gtk_style_context_remove_class (gtk_widget_get_style_context (info->icon_window), "background");
 
       gtk_window_set_hardcoded_window (GTK_WINDOW (info->icon_window),
                                        gdk_drag_context_get_drag_window (context));
@@ -1802,11 +1798,12 @@ gtk_drag_set_icon_surface (GdkDragContext  *context,
   gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
 
   gtk_widget_set_events (window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
-  gtk_widget_set_app_paintable (window, TRUE);
 
   gtk_widget_set_size_request (window, extents.width, extents.height);
   gtk_widget_realize (window);
 
+  gtk_style_context_remove_class (gtk_widget_get_style_context (window), "background");
+
   pattern = cairo_pattern_create_for_surface (surface);
   cairo_matrix_init_translate (&matrix, extents.x, extents.y);
   cairo_pattern_set_matrix (pattern, &matrix);
index 99f5b5fd5fec5ecfc348bf61d632c8b77f224e8c..518a28dda8d7e34eb55d024f5e5606f93b52a18a 100644 (file)
@@ -521,8 +521,7 @@ static gboolean
 gtk_event_box_draw (GtkWidget *widget,
                     cairo_t   *cr)
 {
-  if (gtk_widget_get_has_window (widget) &&
-      !gtk_widget_get_app_paintable (widget))
+  if (gtk_widget_get_has_window (widget))
     {
       GtkStyleContext *context;
 
index 80312cf5c0d5c4a8e6fabbabb754ef53ec6bb163..8f8f9f5ccab6bea41be9f30487a215a40d79a6ca 100644 (file)
@@ -969,7 +969,6 @@ gtk_gl_area_init (GtkGLArea *area)
   GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
 
   gtk_widget_set_has_window (GTK_WIDGET (area), FALSE);
-  gtk_widget_set_app_paintable (GTK_WIDGET (area), TRUE);
 
   priv->auto_render = TRUE;
   priv->needs_render = TRUE;
index 90df011290767d5687ee79a21baf0d7eb0c23791..da36c58f3f5424e8f1c932a9313b388beddab9ab 100644 (file)
@@ -566,7 +566,6 @@ enum {
   PROP_HEIGHT_REQUEST,
   PROP_VISIBLE,
   PROP_SENSITIVE,
-  PROP_APP_PAINTABLE,
   PROP_CAN_FOCUS,
   PROP_HAS_FOCUS,
   PROP_IS_FOCUS,
@@ -1115,13 +1114,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                             TRUE,
                             GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
 
-  widget_props[PROP_APP_PAINTABLE] =
-      g_param_spec_boolean ("app-paintable",
-                            P_("Application paintable"),
-                            P_("Whether the application will paint directly on the widget"),
-                            FALSE,
-                            GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
-
   widget_props[PROP_CAN_FOCUS] =
       g_param_spec_boolean ("can-focus",
                             P_("Can focus"),
@@ -3266,9 +3258,6 @@ gtk_widget_set_property (GObject         *object,
     case PROP_SENSITIVE:
       gtk_widget_set_sensitive (widget, g_value_get_boolean (value));
       break;
-    case PROP_APP_PAINTABLE:
-      gtk_widget_set_app_paintable (widget, g_value_get_boolean (value));
-      break;
     case PROP_CAN_FOCUS:
       gtk_widget_set_can_focus (widget, g_value_get_boolean (value));
       break;
@@ -3441,9 +3430,6 @@ gtk_widget_get_property (GObject         *object,
     case PROP_SENSITIVE:
       g_value_set_boolean (value, gtk_widget_get_sensitive (widget));
       break;
-    case PROP_APP_PAINTABLE:
-      g_value_set_boolean (value, gtk_widget_get_app_paintable (widget));
-      break;
     case PROP_CAN_FOCUS:
       g_value_set_boolean (value, gtk_widget_get_can_focus (widget));
       break;
@@ -8413,63 +8399,6 @@ gtk_widget_set_mapped (GtkWidget *widget,
   widget->priv->mapped = mapped;
 }
 
-/**
- * gtk_widget_set_app_paintable:
- * @widget: a #GtkWidget
- * @app_paintable: %TRUE if the application will paint on the widget
- *
- * Sets whether the application intends to draw on the widget in
- * an #GtkWidget::draw handler.
- *
- * This is a hint to the widget and does not affect the behavior of
- * the GTK+ core; many widgets ignore this flag entirely. For widgets
- * that do pay attention to the flag, such as #GtkEventBox and #GtkWindow,
- * the effect is to suppress default themed drawing of the widget's
- * background. (Children of the widget will still be drawn.) The application
- * is then entirely responsible for drawing the widget background.
- *
- * Note that the background is still drawn when the widget is mapped.
- **/
-void
-gtk_widget_set_app_paintable (GtkWidget *widget,
-                             gboolean   app_paintable)
-{
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  app_paintable = (app_paintable != FALSE);
-
-  if (widget->priv->app_paintable != app_paintable)
-    {
-      widget->priv->app_paintable = app_paintable;
-
-      if (_gtk_widget_is_drawable (widget))
-       gtk_widget_queue_draw (widget);
-
-      g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_APP_PAINTABLE]);
-    }
-}
-
-/**
- * gtk_widget_get_app_paintable:
- * @widget: a #GtkWidget
- *
- * Determines whether the application intends to draw on the widget in
- * an #GtkWidget::draw handler.
- *
- * See gtk_widget_set_app_paintable()
- *
- * Returns: %TRUE if the widget is app paintable
- *
- * Since: 2.18
- **/
-gboolean
-gtk_widget_get_app_paintable (GtkWidget *widget)
-{
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-
-  return widget->priv->app_paintable;
-}
-
 /**
  * gtk_widget_set_redraw_on_allocate:
  * @widget: a #GtkWidget
index b1ab5409a091f4da31e1379d26489848af46eaf1..7187c5d9e55b3c02c96ef92671ab1258b12d1937 100644 (file)
@@ -195,9 +195,9 @@ struct _GtkWidget
  *   width-for-height geometry management for a said widget and is the
  *   default return.
  *   It’s important to note (as described below) that any widget
- *   which trades height-for-width or width-for-height must respond properly 
+ *   which trades height-for-width or width-for-height must respond properly
  *   to both of the virtual methods #GtkWidgetClass.get_preferred_height_for_width()
- *   and #GtkWidgetClass.get_preferred_width_for_height() since it might be 
+ *   and #GtkWidgetClass.get_preferred_width_for_height() since it might be
  *   queried in either #GtkSizeRequestMode by its parent container.
  * @measure: This is called by containers to obtain the minimum and natural
  *   size of the widget. Depending on the orientation parameter, the passed
@@ -712,7 +712,7 @@ gboolean   gtk_widget_send_focus_change   (GtkWidget           *widget,
 
 GDK_AVAILABLE_IN_ALL
 gboolean   gtk_widget_activate              (GtkWidget        *widget);
-     
+
 GDK_AVAILABLE_IN_ALL
 gboolean   gtk_widget_intersect                  (GtkWidget           *widget,
                                           const GdkRectangle  *area,
@@ -823,12 +823,6 @@ void                  gtk_widget_set_mapped             (GtkWidget    *widget,
 GDK_AVAILABLE_IN_ALL
 gboolean              gtk_widget_get_mapped             (GtkWidget    *widget);
 
-GDK_AVAILABLE_IN_ALL
-void                  gtk_widget_set_app_paintable      (GtkWidget    *widget,
-                                                        gboolean      app_paintable);
-GDK_AVAILABLE_IN_ALL
-gboolean              gtk_widget_get_app_paintable      (GtkWidget    *widget);
-
 GDK_AVAILABLE_IN_ALL
 void                  gtk_widget_set_redraw_on_allocate (GtkWidget    *widget,
                                                         gboolean      redraw_on_allocate);
index fe7e05aadadc9e90aa0b5a208d1f158fdcf6582e..039dc1b076e1998f43e419c9dc3e627cffa32cba 100644 (file)
@@ -65,7 +65,6 @@ struct _GtkWidgetPrivate
   guint receives_default      : 1;
   guint has_grab              : 1;
   guint shadowed              : 1;
-  guint app_paintable         : 1;
   guint redraw_on_alloc       : 1;
   guint no_show_all           : 1;
   guint child_visible         : 1;
index e48ed6b7f9f2c5d382361e9555f6e5390d63b1cf..1eeb7464504f7a2815de886f8a47624221f8087e 100644 (file)
@@ -6808,18 +6808,15 @@ update_opaque_region (GtkWindow           *window,
   cairo_region_t *opaque_region;
   GtkStyleContext *context;
   gboolean is_opaque = FALSE;
+  const GdkRGBA *color;
 
   if (!_gtk_widget_get_realized (widget))
       return;
 
   context = gtk_widget_get_style_context (widget);
 
-  if (!gtk_widget_get_app_paintable (widget))
-    {
-      const GdkRGBA *color;
-      color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
-      is_opaque = (color->alpha >= 1.0);
-    }
+  color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
+  is_opaque = (color->alpha >= 1.0);
 
   if (gtk_widget_get_opacity (widget) < 1.0)
     is_opaque = FALSE;
@@ -9456,30 +9453,27 @@ gtk_window_get_render_node (GtkWidget   *widget,
       gtk_style_context_restore (context);
     }
 
-  if (!gtk_widget_get_app_paintable (widget))
-    {
-      if (priv->title_box &&
-          gtk_widget_get_visible (priv->title_box) &&
-          gtk_widget_get_child_visible (priv->title_box))
-        title_height = priv->title_height;
-      else
-        title_height = 0;
-
-      gtk_render_background (context, cr,
-                             window_border.left,
-                             window_border.top + title_height,
-                             allocation.width -
-                               (window_border.left + window_border.right),
-                             allocation.height -
-                               (window_border.top + window_border.bottom + title_height));
-      gtk_render_frame (context, cr,
-                        window_border.left,
-                        window_border.top + title_height,
-                        allocation.width -
-                          (window_border.left + window_border.right),
-                        allocation.height -
-                          (window_border.top + window_border.bottom + title_height));
-    }
+  if (priv->title_box &&
+      gtk_widget_get_visible (priv->title_box) &&
+      gtk_widget_get_child_visible (priv->title_box))
+    title_height = priv->title_height;
+  else
+    title_height = 0;
+
+  gtk_render_background (context, cr,
+                         window_border.left,
+                         window_border.top + title_height,
+                         allocation.width -
+                           (window_border.left + window_border.right),
+                         allocation.height -
+                           (window_border.top + window_border.bottom + title_height));
+  gtk_render_frame (context, cr,
+                    window_border.left,
+                    window_border.top + title_height,
+                    allocation.width -
+                      (window_border.left + window_border.right),
+                    allocation.height -
+                      (window_border.top + window_border.bottom + title_height));
 
   cairo_destroy (cr);
 
index 2c37857ae9e284798b4e4f408ba065956a31bb4f..042ed6130a581f530a518307cc92ff4211ddf6b5 100644 (file)
@@ -194,7 +194,6 @@ main(int argc, char **argv)
 
   gtk_window_set_keep_above (GTK_WINDOW (window), TRUE);
   gtk_window_set_gravity (GTK_WINDOW (window), GDK_GRAVITY_CENTER);
-  gtk_widget_set_app_paintable (window, TRUE);
 
   g_signal_connect (window, "draw",
                     G_CALLBACK (on_window_draw), NULL);
index 1aa26602d7705dab3e59068bcffbe558683c8660..31512d6bbe7a177eb892fce1df96641d54e49c03 100644 (file)
@@ -43,9 +43,7 @@ main (int argc, char **argv)
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
-  gtk_widget_set_app_paintable (window, TRUE);
   gtk_widget_add_events (window, GDK_POINTER_MOTION_MASK);
-  gtk_widget_set_app_paintable (window, TRUE);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_container_add (GTK_CONTAINER (window), vbox);
index 18b650852ec7d1d445188ede54791e097a4217fb..e8d42208906639c5c9341489da844981a47e3541 100644 (file)
@@ -149,7 +149,6 @@ main (int argc, char *argv[])
   gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
 
   ebox = gtk_event_box_new ();
-  gtk_widget_set_app_paintable (ebox, TRUE);
   gtk_container_add (GTK_CONTAINER (ebox), label);
 
   gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, TRUE);
index beabc0c084857a522ec61c5660e9c0f50607d86d..3d092d649cb31636a7ec1cb5ffe7986d6b7d28cd 100644 (file)
@@ -256,7 +256,6 @@ create_alpha_window (GtkWidget *widget)
                                            "_Close", 0,
                                            NULL);
 
-      gtk_widget_set_app_paintable (window, TRUE);
       g_signal_connect (window, "draw",
                        G_CALLBACK (on_alpha_window_draw), NULL);
 
index cd82468c4980e3b163913c518e192bcc11212176..bb126cbd6a3eb30c21dea7afbfad2a36693a5c22 100644 (file)
@@ -37,7 +37,6 @@ on_map_event (GtkWidget *parent,
   popup = gtk_window_new (GTK_WINDOW_POPUP);
 
   gtk_widget_set_size_request (GTK_WIDGET (popup), 20, 20);
-  gtk_widget_set_app_paintable (GTK_WIDGET (popup), TRUE);
   gtk_window_set_transient_for (GTK_WINDOW (popup), GTK_WINDOW (parent));
   g_signal_connect (popup, "draw", G_CALLBACK (draw_popup), NULL);
   g_signal_connect (parent, "motion-notify-event", G_CALLBACK (place_popup), popup);
index 4a8884d1eb7132f1c5434ac883bd545cd125218c..93b3dedbf0f2f1fcaaf5e7c2f0826ed6c1f3dfd2 100644 (file)
@@ -59,7 +59,6 @@ query_tooltip_custom_cb (GtkWidget  *widget,
 {
   GtkWindow *window = gtk_widget_get_tooltip_window (widget);
 
-  gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
   g_signal_connect (window, "draw", G_CALLBACK (draw_tooltip), NULL);
 
   return TRUE;
index bc5de1e5fe7c6a92e62a44fa8921e5b4a01e3bfe..e8b7e0cf4241cc959dbf46de32538465e74dce24 100644 (file)
@@ -374,7 +374,6 @@ main(int argc, char **argv)
     }
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_widget_set_app_paintable (window, TRUE);
   gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
 
   g_signal_connect (window, "draw",